/*!
  @file string_msg.h
  @copyright 2013 Kubota Lab. All rights resereved.
*/

#ifndef _NET_STRING_MSG_H_
#define _NET_STRING_MSG_H_

#include <string>
#include "net/message/message.h"

namespace net {

/*! 
 *  @brief  String message class
 *  @author Kyohei Otsu <kyon@ac.jaxa.jp>
 *  @date   2013
 *  
 *  container which transports a text message
 */

class StringMsg : public Message {
 public:
  StringMsg() 
      : str_("hogehoge")
  { 
    id_ = 3131;
  }

  ~StringMsg() { }

  std::string &str() { return str_; }

 private:
  virtual void setBodyData(char* body, size_t body_len) {
    strncpy(body, str_.c_str(), body_len);
  }
  virtual const char* getBodyData() const { return str_.c_str(); }
  virtual const size_t getBodyLength() const { return str_.length(); }

  std::string str_;
};

} // namespace net

#endif
